<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>x%=y赋值运算符</title>
</head>

<body>
    <p>设置 x=10 和 y=5, 计算 x%=y, 并显示结果。</p>
    <button onclick="myFunction()">点我</button>
    <p id="demo"></p>
    <script>
        function myFunction() {
            var x = 10;
            var y = 5;
            x %= y;
            var demoP = document.getElementById("demo")
            demoP.innerHTML = "x=" + x;
        }
    </script>
</body>

</html>